<?php

/**
*	站点信息1
*
*/

//包含公共文件
include '../../common/common.php';

//接收get传值
// var_dump($_POST);
$siteTitle = trim($_POST['siteTitle']);
$urlName  = trim($_POST['urlName']);
$url 	     = trim($_POST['url']);
$siteIcp    = trim($_POST['siteIcp']);
$isClose    = trim($_POST['isclose']);

//打印
// var_dump($siteTitle);
// var_dump($urlName);
// var_dump($url);
// var_dump($siteIcp);
// var_dump($isClose);


//判断输入项是否为空 (每一项都不得为空)
if (!$siteTitle || !$urlName || !$url || !$siteIcp) {

	exit('每一项均不得为空 <a href="'  . $_SERVER['HTTP_REFERER'] .'">返回上一页</a>');
}

//判断url格式是否正确
$url2 = isUrl($url);
if (!$url2) {

	exit('url地址格式错误,请重新输入 <a href="'  . $_SERVER['HTTP_REFERER'] .'">返回上一页</a>');
}

//修改数据库
$data = [
	'stitle' 		=> "$siteTitle", 
	'urlname' 	=> "$urlName", 
	'URL' 		=> "$url", 
	'ICP' 		=> "$siteIcp", 
	'isclose' 	=> $isClose,
	'addtime'	=> time()
];
// var_dump($data);
$resSite1 = myUpdate($link , DB_TABLE_SITE, $data , "sid=8");
// var_dump($resSite1);

//判断是否修改成功
if (!$resSite1) {

	exit('站点信息修改失败 <a href="'  . $_SERVER['HTTP_REFERER'] .'">返回上一页</a>');
}

//跳转页面
echo '站点信息修改成功';
header('refresh:1;url=' . $webSite . 'admin_index.php?big=1&number=11');